#include "processbar.h"
#include <time.h>
#include <stdlib.h>

#define FILEMAX 1024*1024*1024

void download(callback cb)
{
    srand(time(NULL));

    int load = 0;
    while(load < FILEMAX)
    {
        load += rand()%10000000;
        if(load > FILEMAX)
            load = FILEMAX;
        double rate = load * 1.0 / (FILEMAX) * 100; //28.xxx...%
        cb(rate); 
    }
}


int main()
{
    //processbar();
    
    download(processbar);

    return 0;
}
